package club.cearnach.entity;

import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * @author 阮胜
 * @date 2018/5/10 14:20
 */
@Data
@Entity
@DynamicUpdate
@DynamicInsert
public class MovieLanguage implements Serializable {
    private static final long serialVersionUID = -6037252210797574072L;
    @Id
    @Column(name = "movie_language_id")
    @GeneratedValue
    private Integer id;

    @NotBlank
    @Column(name = "movie_language_name", unique = true)
    private String language;

    @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
    private Date updateDate;

    @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", updatable = false)
    private Date createDate;

    public MovieLanguage() {
    }

    public MovieLanguage(String language) {
        this.language = language;
    }
}
